package com.itheima.mapper;

import com.itheima.pojo.OrderSetting;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface OrderSettingMapper {
    /**
     * 添加预约设置
     * @param orderSetting
     */
    @Insert("insert into t_ordersetting (orderDate,number) values (#{orderDate},#{number})")
    void insert(OrderSetting orderSetting);

    /**
     * 根据月份查询预约设置
     * @param begindate
     * @param enddate
     * @return
     */
    @Select("select * from t_ordersetting where orderDate between #{begindate} and #{enddate}")
    List<OrderSetting> getOrderSettingByMonth(LocalDate begindate, LocalDate enddate);

    /**
     * 根据日期修改可预约人数
     * @param orderSetting
     * @return
     */
    @Update("update t_ordersetting set number=#{number} where orderDate=#{orderDate}")
    void update(OrderSetting orderSetting);
}
